<!DOCTYPE html>
<script src="resources/text-based-repaint.js"></script>
<script>
function highlightRange(id, start, end) {
  var frameWindow = document.getElementById('iframe').contentWindow;
  var range = frameWindow.document.createRange();
  var elem = frameWindow.document.getElementById(id).firstChild;
  range.setStart(elem, start);
  range.setEnd(elem, end);
  frameWindow.internals.addTextMatchMarker(range, 'kInactive');
}

function repaintTest() {
  document.getElementById('iframe').contentDocument.getElementById('to-be-changed').textContent = 'After change';
}

if (window.internals) {
  onload = function() {
    highlightRange('unchanged', 11, 17);
    highlightRange('to-be-changed', 15, 21);
    runRepaintAndPixelTest();
  };
}
</script>
Tests paint invalidation of the scrollbar (to repaint tickmarks) on document change when there are text match markers.
Passes if the tickmarks are updated on document change.<br>
<!-- Currently paint invalidation of main frame scrollbar is not tracked,
     so use a frame to show the invalidation of tickmarks. -->
<iframe id="iframe" style="position: absolute; top: 100px; height: 400px" srcdoc="
  <div id='unchanged'>
    Unchanged: findme
  </div>
  <div id='to-be-changed' onclick='this.textContent=&amp;quot;After change&amp;quot;'>
    To be changed: findme (Manual testing: Find-in-page 'findme', then click here)
  </div>
  <div style='height: 1000px'><!-- To show the scrollbar --></div>">
</iframe>
